package springannotaion.compment22;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.stereotype.Component;
import springannotaion.bean.C2;

/**
 * @author sss
 * @date 2020-02-12 12:10
 **/
@Component
public class BeanDefinitionRegistryPostProcessor2 implements BeanDefinitionRegistryPostProcessor {

	@Override
	public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
		registry.registerBeanDefinition("c2",new RootBeanDefinition(C2.class));
		System.out.println("BeanDefinitionRegistryPostProcessor********postProcessBeanDefinitionRegistry*****BeanDefinitionRegistryPostProcessor--------before");
	}

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		System.out.println("BeanDefinitionRegistryPostProcessor*********postProcessBeanFactory******BeanDefinitionRegistryPostProcessor--------After");
	}
}
